function DirectCoupon(params){ 
	 
}

DirectCoupon.Where = function(type,proxy){
	this.type = type;
	this.proxy=proxy;
	this.linked = null;
	this.set = null;
	if(this.type==0){
		this.set = new DirectCoupon.Where(1,true);
		this.set.linked = this;
	}
	this.getProxy = function(){
		var m = new DirectCoupon.Where(this.type);//当前的对像
		if(this.type==0){
			m.set = new DirectCoupon.Where(1,true);//set对象
			m.set.linked = m;
		}else{
			m.linked=this.linked;
			this.linked.linked=m;
		}
		return m;
	}
	this.data = {};
	this.put = function(key,value){
		this.data[key] = value;
	}
	this.get = function(key){
		return this.data[key];
	}
	/** 编号 [非空]       **/
	this.id=function(id){if(this.proxy)return this.getProxy().id(id);  this.put("id", id);return this;};
	/** and id is null */
	this.idNull=function(){if(this.proxy)return this.getProxy().idNull();if(this.get("idNot")==null)this.put("idNot", "");this.put("id", null);return this;};
	/** not .... */
	this.idNot=function(){if(this.proxy)return this.getProxy().idNot();this.put("idNot", "not");return this;};
	this.idNotNull=function(){if(this.proxy)return this.getProxy().idNotNull();this.put("idNot", "not");this.put("id", null);return this;};
	this.idNot=function(id){if(this.proxy)return this.getProxy().idNot(id);this.put("idNot", "not");this.put("id", id);return this;};
	/** and id <= ? */
	this.idMin=function(min){if(this.proxy)return this.getProxy().idMin(min);this.put("idMin", min);return this;};
	/** and id >= ? */
	this.idMax=function(max){if(this.proxy)return this.getProxy().idMax(max);this.put("idMax", max);return this;};
	this.idIn=function(ids){
		if(this.proxy)return this.getProxy().idIn(ids);  this.put("idIn", ids);return this;
	};	
	
	/** 所属品牌 [非空] [Merchant]      **/
	this.merchant=function(merchant){if(this.proxy)return this.getProxy().merchant(merchant);  this.put("merchant", merchant);return this;};
	/** and merchant is null */
	this.merchantNull=function(){if(this.proxy)return this.getProxy().merchantNull();if(this.get("merchantNot")==null)this.put("merchantNot", "");this.put("merchant", null);return this;};
	/** not .... */
	this.merchantNot=function(){if(this.proxy)return this.getProxy().merchantNot();this.put("merchantNot", "not");return this;};
	this.merchantNotNull=function(){if(this.proxy)return this.getProxy().merchantNotNull();this.put("merchantNot", "not");this.put("merchant", null);return this;};
	this.merchantNot=function(merchant){if(this.proxy)return this.getProxy().merchantNot(merchant);this.put("merchantNot", "not");this.put("merchant", merchant);return this;};
	this.merchantIn=function(ids){
		if(this.proxy)return this.getProxy().merchantIn(ids);  this.put("merchantIn", ids);return this;
	};	
	
	/** 优惠券名称 [非空]       **/
	this.title=function(title){if(this.proxy)return this.getProxy().title(title);  this.put("title", title);return this;};
	/** and title is null */
	this.titleNull=function(){if(this.proxy)return this.getProxy().titleNull();if(this.get("titleNot")==null)this.put("titleNot", "");this.put("title", null);return this;};
	/** not .... */
	this.titleNot=function(){if(this.proxy)return this.getProxy().titleNot();this.put("titleNot", "not");return this;};
	this.titleNotNull=function(){if(this.proxy)return this.getProxy().titleNotNull();this.put("titleNot", "not");this.put("title", null);return this;};
	this.titleNot=function(title){if(this.proxy)return this.getProxy().titleNot(title);this.put("titleNot", "not");this.put("title", title);return this;};
	
	/** 生成数量 [非空]       **/
	this.count=function(count){if(this.proxy)return this.getProxy().count(count);  this.put("count", count);return this;};
	/** and count is null */
	this.countNull=function(){if(this.proxy)return this.getProxy().countNull();if(this.get("countNot")==null)this.put("countNot", "");this.put("count", null);return this;};
	/** not .... */
	this.countNot=function(){if(this.proxy)return this.getProxy().countNot();this.put("countNot", "not");return this;};
	this.countNotNull=function(){if(this.proxy)return this.getProxy().countNotNull();this.put("countNot", "not");this.put("count", null);return this;};
	this.countNot=function(count){if(this.proxy)return this.getProxy().countNot(count);this.put("countNot", "not");this.put("count", count);return this;};
	/** and count <= ? */
	this.countMin=function(min){if(this.proxy)return this.getProxy().countMin(min);this.put("countMin", min);return this;};
	/** and count >= ? */
	this.countMax=function(max){if(this.proxy)return this.getProxy().countMax(max);this.put("countMax", max);return this;};
	this.countIn=function(ids){
		if(this.proxy)return this.getProxy().countIn(ids);  this.put("countIn", ids);return this;
	};	
	
	/** 折扣 [非空]    最大设9.9折 不能大于等于10  也不能为负数   **/
	this.discount=function(discount){if(this.proxy)return this.getProxy().discount(discount);  this.put("discount", discount);return this;};
	/** and discount is null */
	this.discountNull=function(){if(this.proxy)return this.getProxy().discountNull();if(this.get("discountNot")==null)this.put("discountNot", "");this.put("discount", null);return this;};
	/** not .... */
	this.discountNot=function(){if(this.proxy)return this.getProxy().discountNot();this.put("discountNot", "not");return this;};
	this.discountNotNull=function(){if(this.proxy)return this.getProxy().discountNotNull();this.put("discountNot", "not");this.put("discount", null);return this;};
	this.discountNot=function(discount){if(this.proxy)return this.getProxy().discountNot(discount);this.put("discountNot", "not");this.put("discount", discount);return this;};
	/** and discount <= ? */
	this.discountMin=function(min){if(this.proxy)return this.getProxy().discountMin(min);this.put("discountMin", min);return this;};
	/** and discount >= ? */
	this.discountMax=function(max){if(this.proxy)return this.getProxy().discountMax(max);this.put("discountMax", max);return this;};
	
	/** 规则介绍 [非空]       **/
	this.introduction=function(introduction){if(this.proxy)return this.getProxy().introduction(introduction);  this.put("introduction", introduction);return this;};
	/** and introduction is null */
	this.introductionNull=function(){if(this.proxy)return this.getProxy().introductionNull();if(this.get("introductionNot")==null)this.put("introductionNot", "");this.put("introduction", null);return this;};
	/** not .... */
	this.introductionNot=function(){if(this.proxy)return this.getProxy().introductionNot();this.put("introductionNot", "not");return this;};
	this.introductionNotNull=function(){if(this.proxy)return this.getProxy().introductionNotNull();this.put("introductionNot", "not");this.put("introduction", null);return this;};
	this.introductionNot=function(introduction){if(this.proxy)return this.getProxy().introductionNot(introduction);this.put("introductionNot", "not");this.put("introduction", introduction);return this;};
	
	/** 截止时间 [非空]       **/
	this.deadline=function(deadline){if(this.proxy)return this.getProxy().deadline(deadline);  this.put("deadline", deadline);return this;};
	/** and deadline is null */
	this.deadlineNull=function(){if(this.proxy)return this.getProxy().deadlineNull();if(this.get("deadlineNot")==null)this.put("deadlineNot", "");this.put("deadline", null);return this;};
	/** not .... */
	this.deadlineNot=function(){if(this.proxy)return this.getProxy().deadlineNot();this.put("deadlineNot", "not");return this;};
	this.deadlineNotNull=function(){if(this.proxy)return this.getProxy().deadlineNotNull();this.put("deadlineNot", "not");this.put("deadline", null);return this;};
	this.deadlineNot=function(deadline){if(this.proxy)return this.getProxy().deadlineNot(deadline);this.put("deadlineNot", "not");this.put("deadline", deadline);return this;};
	/** and deadline >= ? */
	this.deadlineStart=function(start){if(this.proxy)return this.getProxy().deadlineStart(start);this.put("deadlineStart", start);return this;};			
	/** and deadline <= ? */
	this.deadlineEnd=function(end){if(this.proxy)return this.getProxy().deadlineEnd(end);this.put("deadlineEnd", end);return this;};
	
	/** 定向投放对象    1:全部用户 2:消费金额满 3:注册时间满 4:指定用户     **/
	this.directObject=function(directObject){if(this.proxy)return this.getProxy().directObject(directObject);  this.put("directObject", directObject);return this;};
	/** and direct_object is null */
	this.directObjectNull=function(){if(this.proxy)return this.getProxy().directObjectNull();if(this.get("directObjectNot")==null)this.put("directObjectNot", "");this.put("directObject", null);return this;};
	/** not .... */
	this.directObjectNot=function(){if(this.proxy)return this.getProxy().directObjectNot();this.put("directObjectNot", "not");return this;};
	this.directObjectNotNull=function(){if(this.proxy)return this.getProxy().directObjectNotNull();this.put("directObjectNot", "not");this.put("directObject", null);return this;};
	this.directObjectNot=function(directObject){if(this.proxy)return this.getProxy().directObjectNot(directObject);this.put("directObjectNot", "not");this.put("directObject", directObject);return this;};
	this.directObjectIn=function(ids){
		if(this.proxy)return this.getProxy().directObjectIn(ids);  this.put("directObjectIn", ids);return this;
	};	
	
	/** 消费累计满领        **/
	this.accumulatedFull=function(accumulatedFull){if(this.proxy)return this.getProxy().accumulatedFull(accumulatedFull);  this.put("accumulatedFull", accumulatedFull);return this;};
	/** and accumulated_full is null */
	this.accumulatedFullNull=function(){if(this.proxy)return this.getProxy().accumulatedFullNull();if(this.get("accumulatedFullNot")==null)this.put("accumulatedFullNot", "");this.put("accumulatedFull", null);return this;};
	/** not .... */
	this.accumulatedFullNot=function(){if(this.proxy)return this.getProxy().accumulatedFullNot();this.put("accumulatedFullNot", "not");return this;};
	this.accumulatedFullNotNull=function(){if(this.proxy)return this.getProxy().accumulatedFullNotNull();this.put("accumulatedFullNot", "not");this.put("accumulatedFull", null);return this;};
	this.accumulatedFullNot=function(accumulatedFull){if(this.proxy)return this.getProxy().accumulatedFullNot(accumulatedFull);this.put("accumulatedFullNot", "not");this.put("accumulatedFull", accumulatedFull);return this;};
	/** and accumulated_full <= ? */
	this.accumulatedFullMin=function(min){if(this.proxy)return this.getProxy().accumulatedFullMin(min);this.put("accumulatedFullMin", min);return this;};
	/** and accumulated_full >= ? */
	this.accumulatedFullMax=function(max){if(this.proxy)return this.getProxy().accumulatedFullMax(max);this.put("accumulatedFullMax", max);return this;};
	
	/** 注册满天数领        **/
	this.fullDay=function(fullDay){if(this.proxy)return this.getProxy().fullDay(fullDay);  this.put("fullDay", fullDay);return this;};
	/** and full_day is null */
	this.fullDayNull=function(){if(this.proxy)return this.getProxy().fullDayNull();if(this.get("fullDayNot")==null)this.put("fullDayNot", "");this.put("fullDay", null);return this;};
	/** not .... */
	this.fullDayNot=function(){if(this.proxy)return this.getProxy().fullDayNot();this.put("fullDayNot", "not");return this;};
	this.fullDayNotNull=function(){if(this.proxy)return this.getProxy().fullDayNotNull();this.put("fullDayNot", "not");this.put("fullDay", null);return this;};
	this.fullDayNot=function(fullDay){if(this.proxy)return this.getProxy().fullDayNot(fullDay);this.put("fullDayNot", "not");this.put("fullDay", fullDay);return this;};
	/** and full_day <= ? */
	this.fullDayMin=function(min){if(this.proxy)return this.getProxy().fullDayMin(min);this.put("fullDayMin", min);return this;};
	/** and full_day >= ? */
	this.fullDayMax=function(max){if(this.proxy)return this.getProxy().fullDayMax(max);this.put("fullDayMax", max);return this;};
	this.fullDayIn=function(ids){
		if(this.proxy)return this.getProxy().fullDayIn(ids);  this.put("fullDayIn", ids);return this;
	};	
	
	/** 指定用户  [Member]      **/
	this.desigUser=function(desigUser){if(this.proxy)return this.getProxy().desigUser(desigUser);  this.put("desigUser", desigUser);return this;};
	/** and desig_user is null */
	this.desigUserNull=function(){if(this.proxy)return this.getProxy().desigUserNull();if(this.get("desigUserNot")==null)this.put("desigUserNot", "");this.put("desigUser", null);return this;};
	/** not .... */
	this.desigUserNot=function(){if(this.proxy)return this.getProxy().desigUserNot();this.put("desigUserNot", "not");return this;};
	this.desigUserNotNull=function(){if(this.proxy)return this.getProxy().desigUserNotNull();this.put("desigUserNot", "not");this.put("desigUser", null);return this;};
	this.desigUserNot=function(desigUser){if(this.proxy)return this.getProxy().desigUserNot(desigUser);this.put("desigUserNot", "not");this.put("desigUser", desigUser);return this;};
	this.desigUserIn=function(ids){
		if(this.proxy)return this.getProxy().desigUserIn(ids);  this.put("desigUserIn", ids);return this;
	};	
	
	/** 已领取数量 [非空]       **/
	this.received=function(received){if(this.proxy)return this.getProxy().received(received);  this.put("received", received);return this;};
	/** and received is null */
	this.receivedNull=function(){if(this.proxy)return this.getProxy().receivedNull();if(this.get("receivedNot")==null)this.put("receivedNot", "");this.put("received", null);return this;};
	/** not .... */
	this.receivedNot=function(){if(this.proxy)return this.getProxy().receivedNot();this.put("receivedNot", "not");return this;};
	this.receivedNotNull=function(){if(this.proxy)return this.getProxy().receivedNotNull();this.put("receivedNot", "not");this.put("received", null);return this;};
	this.receivedNot=function(received){if(this.proxy)return this.getProxy().receivedNot(received);this.put("receivedNot", "not");this.put("received", received);return this;};
	/** and received <= ? */
	this.receivedMin=function(min){if(this.proxy)return this.getProxy().receivedMin(min);this.put("receivedMin", min);return this;};
	/** and received >= ? */
	this.receivedMax=function(max){if(this.proxy)return this.getProxy().receivedMax(max);this.put("receivedMax", max);return this;};
	this.receivedIn=function(ids){
		if(this.proxy)return this.getProxy().receivedIn(ids);  this.put("receivedIn", ids);return this;
	};	
	
	/** 已使用数量 [非空]       **/
	this.used=function(used){if(this.proxy)return this.getProxy().used(used);  this.put("used", used);return this;};
	/** and used is null */
	this.usedNull=function(){if(this.proxy)return this.getProxy().usedNull();if(this.get("usedNot")==null)this.put("usedNot", "");this.put("used", null);return this;};
	/** not .... */
	this.usedNot=function(){if(this.proxy)return this.getProxy().usedNot();this.put("usedNot", "not");return this;};
	this.usedNotNull=function(){if(this.proxy)return this.getProxy().usedNotNull();this.put("usedNot", "not");this.put("used", null);return this;};
	this.usedNot=function(used){if(this.proxy)return this.getProxy().usedNot(used);this.put("usedNot", "not");this.put("used", used);return this;};
	/** and used <= ? */
	this.usedMin=function(min){if(this.proxy)return this.getProxy().usedMin(min);this.put("usedMin", min);return this;};
	/** and used >= ? */
	this.usedMax=function(max){if(this.proxy)return this.getProxy().usedMax(max);this.put("usedMax", max);return this;};
	this.usedIn=function(ids){
		if(this.proxy)return this.getProxy().usedIn(ids);  this.put("usedIn", ids);return this;
	};	
	
	/** 适用商品 [非空] [Commodity]      **/
	this.commodity=function(commodity){if(this.proxy)return this.getProxy().commodity(commodity);  this.put("commodity", commodity);return this;};
	/** and commodity is null */
	this.commodityNull=function(){if(this.proxy)return this.getProxy().commodityNull();if(this.get("commodityNot")==null)this.put("commodityNot", "");this.put("commodity", null);return this;};
	/** not .... */
	this.commodityNot=function(){if(this.proxy)return this.getProxy().commodityNot();this.put("commodityNot", "not");return this;};
	this.commodityNotNull=function(){if(this.proxy)return this.getProxy().commodityNotNull();this.put("commodityNot", "not");this.put("commodity", null);return this;};
	this.commodityNot=function(commodity){if(this.proxy)return this.getProxy().commodityNot(commodity);this.put("commodityNot", "not");this.put("commodity", commodity);return this;};
	this.commodityIn=function(ids){
		if(this.proxy)return this.getProxy().commodityIn(ids);  this.put("commodityIn", ids);return this;
	};	
	
	/** 修改时间 [非空]       **/
	this.updateTime=function(updateTime){if(this.proxy)return this.getProxy().updateTime(updateTime);  this.put("updateTime", updateTime);return this;};
	/** and update_time is null */
	this.updateTimeNull=function(){if(this.proxy)return this.getProxy().updateTimeNull();if(this.get("updateTimeNot")==null)this.put("updateTimeNot", "");this.put("updateTime", null);return this;};
	/** not .... */
	this.updateTimeNot=function(){if(this.proxy)return this.getProxy().updateTimeNot();this.put("updateTimeNot", "not");return this;};
	this.updateTimeNotNull=function(){if(this.proxy)return this.getProxy().updateTimeNotNull();this.put("updateTimeNot", "not");this.put("updateTime", null);return this;};
	this.updateTimeNot=function(updateTime){if(this.proxy)return this.getProxy().updateTimeNot(updateTime);this.put("updateTimeNot", "not");this.put("updateTime", updateTime);return this;};
	/** and update_time >= ? */
	this.updateTimeStart=function(start){if(this.proxy)return this.getProxy().updateTimeStart(start);this.put("updateTimeStart", start);return this;};			
	/** and update_time <= ? */
	this.updateTimeEnd=function(end){if(this.proxy)return this.getProxy().updateTimeEnd(end);this.put("updateTimeEnd", end);return this;};
	
	/** 添加时间 [非空]       **/
	this.addTime=function(addTime){if(this.proxy)return this.getProxy().addTime(addTime);  this.put("addTime", addTime);return this;};
	/** and add_time is null */
	this.addTimeNull=function(){if(this.proxy)return this.getProxy().addTimeNull();if(this.get("addTimeNot")==null)this.put("addTimeNot", "");this.put("addTime", null);return this;};
	/** not .... */
	this.addTimeNot=function(){if(this.proxy)return this.getProxy().addTimeNot();this.put("addTimeNot", "not");return this;};
	this.addTimeNotNull=function(){if(this.proxy)return this.getProxy().addTimeNotNull();this.put("addTimeNot", "not");this.put("addTime", null);return this;};
	this.addTimeNot=function(addTime){if(this.proxy)return this.getProxy().addTimeNot(addTime);this.put("addTimeNot", "not");this.put("addTime", addTime);return this;};
	/** and add_time >= ? */
	this.addTimeStart=function(start){if(this.proxy)return this.getProxy().addTimeStart(start);this.put("addTimeStart", start);return this;};			
	/** and add_time <= ? */
	this.addTimeEnd=function(end){if(this.proxy)return this.getProxy().addTimeEnd(end);this.put("addTimeEnd", end);return this;};
	
	/** 状态 [非空]   1:正常 0:无效     **/
	this.status=function(status){if(this.proxy)return this.getProxy().status(status);  this.put("status", status);return this;};
	/** and status is null */
	this.statusNull=function(){if(this.proxy)return this.getProxy().statusNull();if(this.get("statusNot")==null)this.put("statusNot", "");this.put("status", null);return this;};
	/** not .... */
	this.statusNot=function(){if(this.proxy)return this.getProxy().statusNot();this.put("statusNot", "not");return this;};
	this.statusNotNull=function(){if(this.proxy)return this.getProxy().statusNotNull();this.put("statusNot", "not");this.put("status", null);return this;};
	this.statusNot=function(status){if(this.proxy)return this.getProxy().statusNot(status);this.put("statusNot", "not");this.put("status", status);return this;};
	this.statusIn=function(ids){
		if(this.proxy)return this.getProxy().statusIn(ids);  this.put("statusIn", ids);return this;
	};	
	
	
	
	this.add=function(key,value) {if(proxy)return proxy().add(key,value);this.put(key, value);return this;}
	this.desc=function(sql) {if(proxy)return proxy().desc(sql);this.put("desc", sql);return this;}
	this.asc=function(sql) {if(proxy)return proxy().asc(sql);this.put("asc", sql);return this;}
	this.definex=function(sql) {if(proxy)return proxy().definex(sql);this.put("definex", sql);return this;}
	
	/** 获取所有定向优惠券 **/
	this.list=function(size){
		this.data.size = size;
		var protocol = ux.ajax("/admin/coupons/directcoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list)return protocol.data.list;
		return [];
	}
	/** 获取定向优惠券分页 **/
	this.page=function(page,size){
		this.data.size = size;
		this.data.page = page;
		var protocol = ux.ajax("/admin/coupons/directcoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data)return data;
		return {list:[]};
	}
	/** 根据查询条件取定向优惠券 **/
	this.get=function(){
		this.data.size = 1;
		var protocol = ux.ajax("/admin/coupons/directcoupon.list.do",this.data);
		if(!protocol)return null;
		if(protocol.data && protocol.data.list && protocol.data.list.length==1)return protocol.data.list[0]; 
		return null;
	}
}

DirectCoupon.get = function(id){
	var protocol = ux.ajax("/admin/coupons/directcoupon.get.do",{id:id});
	if(!protocol)return null;
	if(protocol.data)return protocol.data.directCoupon;
	return null;
}

DirectCoupon.where = new DirectCoupon.Where(0,true);